package com.bckj.fastboot.iot.api.service;

import com.bckj.fastboot.core.lang.model.PageResult;
import com.bckj.fastboot.iot.common.constant.IotConstants;
import com.bckj.fastboot.iot.common.dto.query.IotProtocolQuery;
import com.bckj.fastboot.iot.common.dto.request.IotProtocolRequest;
import com.bckj.fastboot.iot.common.dto.response.IotProtocolResponse;
import com.bckj.fastboot.iot.common.entity.IotProtocolItem;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * IotProtocolRemoteService
 *
 * @author wfc
 * @date 2025/9/25 11:15
 **/
@FeignClient(value = IotConstants.SERVICE_ID, contextId = "iotProtocol", path = "iotProtocol")
public interface IotProtocolRemoteService {

    @PostMapping()
    boolean save(@RequestBody IotProtocolRequest request);

    @PutMapping()
    boolean update(@RequestBody IotProtocolRequest request);

    @GetMapping("/{id}")
    IotProtocolResponse details(@PathVariable Long id);

    @GetMapping("/page")
    PageResult<IotProtocolResponse> page(@SpringQueryMap IotProtocolQuery query);

    @GetMapping("clearItemsCache")
    void clearItemsCache(@RequestParam String protocolCode, @RequestParam String cmd);

    @GetMapping("findItems")
    List<IotProtocolItem> findItems(@RequestParam String protocolCode, @RequestParam String cmd);
}
